package com.keyijie.user.controller;

import com.keyijie.common.restful.RestBody;
import com.keyijie.common.restful.RestCode;
import com.keyijie.user.entity.UserInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping(value = "/{id}")
    public RestBody json(@PathVariable("id") long id) {
        RestBody<UserInfo> body = new RestBody<>(RestCode.OK);
        UserInfo userInfo = new UserInfo();
        userInfo.setId(id);
        userInfo.setName("这是User示例-AAAAA11111");
        body.setData(userInfo);
        body.setMessage("mse111111111");
        userInfo.setDate(new Date());
        return body;
    }

    @GetMapping("/json")
    public RestBody json() {
        RestBody<String> body = new RestBody<>(RestCode.OK);
        body.setData("这是User示例-AAAAA111111");
        return body;
    }
}
